cmake_minimum_required(VERSION 3.27)
project(YunShi)

set(CMAKE_CXX_STANDARD 20)

# boost网络库
find_package(Boost REQUIRED)
# 找寻PkgConfig,用于查找库
find_package(PkgConfig REQUIRED)

# jsoncpp
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
# spdlog 异步日志库
pkg_check_modules(SPDLOG REQUIRED spdlog)
# openSSL
pkg_check_modules(OPENSSL REQUIRED openssl)
# hiredis
pkg_check_modules(HIREDIS REQUIRED hiredis)

include_directories(
        ${BOOST_INCLUDE_DIRS}
        ${JSONCPP_INCLUDE_DIRS}
        ${SPDLOG_INCLUDE_DIRS}
        ${OPENSSL_INCLUDE_DIRS}
        ${HIREDIS_INCLUDE_DIRS}

        Config
        Controller/HttpRouter
        Controller/BaseController
        Controller/SuperAdminController
        Controller/AdminController
        Controller/EmployeeController
        Controller/UserController
        Controller/TokenError
        Database/MySQLConnectionPool
        Database/MySQLDatabaseModel
        Database/RedisConnectionPool
        Database/RedisDatabaseModel
        Model
        Model/User
        Model/Employee
        Model/Admin
        Service/Interface
        Service/SuperAdminService
        Service/AdminService
        Service/EmployeeService
        Service/UserService
        UnderlyingServer
        UnderlyingServer/HttpConnection
        Utils/LogManager
        Utils/Singleton
        Utils/JWT
        Utils/Security
        Utils/SendHttp
)

add_executable(YunShi YunShi.cpp
        Config/Config.cpp
        Config/Config.h
        Utils/Singleton/Singleton.h
        Utils/JWT/JWT.cpp
        Utils/JWT/JWT.h
        Utils/LogManager/LogManager.cpp
        Utils/LogManager/LogManager.h
        UnderlyingServer/HttpConnection/HttpConnection.cpp
        UnderlyingServer/HttpConnection/HttpConnection.h
        UnderlyingServer/UnderlyingServer.cpp
        UnderlyingServer/UnderlyingServer.h
        Controller/HttpRouter/HttpRouter.cpp
        Controller/HttpRouter/HttpRouter.h
        Controller/AdminController/AdminController.cpp
        Controller/AdminController/AdminController.h
        Database/MySQLConnectionPool/MySQLConnectionPool.cpp
        Database/MySQLConnectionPool/MySQLConnectionPool.h
        Database/MySQLDatabaseModel/MySQLDatabaseModel.cpp
        Database/MySQLDatabaseModel/MySQLDatabaseModel.h
        Database/RedisConnectionPool/RedisConnectionPool.cpp
        Database/RedisConnectionPool/RedisConnectionPool.h
        Service/Interface/IAdminService.h
        Service/AdminService/AdminService.cpp
        Service/AdminService/AdminService.h
        Database/RedisDatabaseModel/RedisDatabaseModel.cpp
        Database/RedisDatabaseModel/RedisDatabaseModel.h
        Controller/EmployeeController/EmployeeController.cpp
        Controller/EmployeeController/EmployeeController.h
        Service/Interface/IEmployeeService.h
        Service/EmployeeService/EmployeeService.cpp
        Service/EmployeeService/EmployeeService.h
        Utils/Security/Security.cpp
        Utils/Security/Security.h
        Model/User/UserJWT.cpp
        Model/User/UserJWT.h
        Model/Model.h
        Controller/UserController/UserController.cpp
        Controller/UserController/UserController.h
        Service/Interface/IUserService.h
        Service/UserService/UserService.cpp
        Service/UserService/UserService.h
        Model/User/UserLogin.cpp
        Model/User/UserLogin.h
        Controller/TokenError/TokenError.cpp
        Controller/TokenError/TokenError.h
        Controller/BaseController/BaseController.cpp
        Controller/BaseController/BaseController.h
        Controller/SuperAdminController/SuperAdminController.cpp
        Controller/SuperAdminController/SuperAdminController.h
        Service/Interface/ISuperAdminService.h
        Service/SuperAdminService/SuperAdminService.cpp
        Service/SuperAdminService/SuperAdminService.h
        Model/Employee/EmployeeModifyPassword.cpp
        Model/Employee/EmployeeModifyPassword.h
        Model/Employee/EmployeeSetting.cpp
        Model/Employee/EmployeeSetting.h
        Utils/SendHttp/SendHttp.cpp
        Utils/SendHttp/SendHttp.h
        Model/Employee/EmployeeFaceFeatures.cpp
        Model/Employee/EmployeeFaceFeatures.h
        Model/Employee/EmployeeTodayAttendance.cpp
        Model/Employee/EmployeeTodayAttendance.h
        Model/Employee/EmployeeAttendance.cpp
        Model/Employee/EmployeeAttendance.h
        Model/Employee/EmployeeAttendanceRules.cpp
        Model/Employee/EmployeeAttendanceRules.h
        Model/Employee/EmployeeInformation.cpp
        Model/Employee/EmployeeInformation.h
        Model/Admin/AdminInformation.cpp
        Model/Admin/AdminInformation.h
        Model/Employee/EmployeeAllAttendance.cpp
        Model/Employee/EmployeeAllAttendance.h
        Model/Employee/EmployeeGetName.cpp
        Model/Employee/EmployeeGetName.h
        Model/Employee/EmployeeFingerprint.cpp
        Model/Employee/EmployeeFingerprint.h
)

target_link_libraries(YunShi PRIVATE
        ${BOOST_LIBRARIES}
        ${SPDLOG_LIBRARIES}
        ${JSONCPP_LIBRARIES}
        ${OPENSSL_LIBRARIES}
        ${HIREDIS_LIBRARIES}
        mysqlcppconn
)

